export MYSHELL=$(basename $SHELL)
export EDITOR=vim
export PAGER='less -FirSX'
export EMAIL='tyler@tylercipriani.com'
export DEBEMAIL='tcipriani@wikimedia.org'
export DEBFULLNAME='Tyler Cipriani'

prepend_to_path() {
  local dir="$1"

  if [[ -d "${dir}" ]]; then
    if [[ ":$PATH:" != *"${dir}"* ]]; then
      PATH="${dir}:${PATH}"
    fi
  fi
}

prepend_to_path "/usr/games"
prepend_to_path "/usr/local/games"
prepend_to_path "/bin"
prepend_to_path "/sbin"
prepend_to_path "/usr/bin"
prepend_to_path "/usr/sbin"
prepend_to_path "/usr/local/bin"
prepend_to_path "/usr/local/sbin"
prepend_to_path "/usr/local/plan9"
prepend_to_path "/usr/local/go/bin"
prepend_to_path "$HOME/Projects/play"
prepend_to_path "$(ruby -e 'print Gem.user_dir')/bin"
prepend_to_path "$HOME/.cabal/bin"
prepend_to_path "$HOME/.local/bin"
prepend_to_path "$HOME/bin"

if [  "$(uname -s)" = "Darwin" ]; then
    PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
    MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
fi

# http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html
export MARKPATH=$HOME/.marks
export CDPATH=$HOME/.marks

# Less Colors for Man Pages http://nion.modprobe.de/blog/archives/572-less-colors-for-man-pages.html
export LESS_TERMCAP_mb=$'\E[01;31m'       # begin blinking
export LESS_TERMCAP_md=$'\E[01;38;5;74m'  # begin bold
export LESS_TERMCAP_me=$'\E[0m'           # end mode
export LESS_TERMCAP_se=$'\E[0m'           # end standout-mode
export LESS_TERMCAP_so=$'\E[38;5;246m'    # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\E[0m'           # end underline
export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline

# Keychain to manage gpg-agent and ssh-agent
if command -v keychain > /dev/null 2>&1; then
  eval $(keychain --agents 'ssh gpg' --eval)
fi

[ -r "$HOME/.api_keys" ] && . "$HOME/.api_keys"

if [ -d "$HOME/go" ]; then
    export GOPATH="$HOME/go"
    PATH="$GOPATH/bin:$PATH"
fi

if [ -f "$HOME/.amazonrc" ]; then
    eval $(/usr/bin/env python2 "$HOME/.amazonrc")
fi

[ -d "$HOME/.rvm/bin" ] && prepend_to_path "$HOME/.rvm/bin" # Add RVM to PATH for scripting

[ -d "$HOME/.rbenv/bin" ] && {
    prepend_to_path "$HOME/.rbenv/bin"
    prepend_to_path "$HOME/.rbenv/plugins/ruby-build/bin"
    eval "$(rbenv init -)"
}

if command -v sshecret > /dev/null 2>&1; then
    export GIT_SSH=sshecret
fi
